import lookUp from "./lookUp";
import parseArray from "./parseArray";
export default function enderTemplate(tokens, data) {
  let resultStr = '';
  // 遍历tokens
  for (let i in tokens) {
    let token = tokens[i];
    if (token[0] == 'text') {
      resultStr += token[1]
    } else if (token[0] == 'name') {
      resultStr += lookUp(data, token[1])
    } else if (token[0] == '#') {
      resultStr += parseArray(token,data);
    }
  }
  return resultStr
}